package com.jf.test.mvvm.base

import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.lifecycle.ViewModelProvider

/**
 * @Class: BaseActivity
 * @Description:
 * @author: github.com/jackyflame
 * @Date: 2021/3/9
 */
open class BaseActivity<X:ViewDataBinding,Y:BaseAcVM<BaseActivity<X,Y>,*>>:AppCompatActivity() {

    var binding:X? = null;
    var viewModel:Y? = null;

    fun bindView(layoutId:Int,clz:Class<Y>){
        binding = DataBindingUtil.setContentView(this, layoutId);
        viewModel = ViewModelProvider(this).get(clz);
        viewModel?.init(this);
        //binding?.setVariable(BR.viewModel,viewModel);
    }

}